<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html>
<html lang="en">
<head>
<base href="<%=basePath%>">

<%@ include file="../top.jsp"%>
<%@ include file="../nav.jsp"%>
</head>

<body>
<div id="main">
<form action="user/list.do" method="post" name="Form" id="Form">

	<div class="page-header position-relative">
			<c:if test="${QX.管理基本信息 == 1 }">
			<table style="width:100%;margin-left:2em;">
				<tr>
					<td style="vertical-align:top;">
					<a class="btn btn-small btn-success" onclick="add();">新增</a>
					<a title="批量注销" class="btn btn-small btn-warning" onclick="makeAll('确定要注销选中的用户吗?');"><i class='icon-remove-sign'></i></a> 
					<a title="批量删除" class="btn btn-small btn-danger" onclick="makeAll('确定要删除选中的用户吗?');"><i class='icon-trash'></i></a> 
					</td>
				</tr>
			</table>
			</c:if>
			</div>
			
	 <div style="width:95%;margin:2em;">
			<table id="table_report" class="table table-striped table-bordered table-hover">
				<tr>
					<th class="center">
						<label><input type="checkbox" id="zcheckbox" /><span class="lbl"></span></label>
					</th>
					<th class="center">id号</th>
					<th class="center">用户名</th>
					<th class="center">电话</th>
					<th class="center">Email</th>
					<th class="center">角色名</th>
					<c:if test="${QX.管理基本信息 == 1 }">
					<th class="center">操作</th>
					</c:if>
				</tr>
				<tbody>
				<!-- 开始循环 -->
				<c:choose>
					<c:when test="${not empty varList}">
						<c:forEach items="${varList}" var="var" varStatus="vs">
							<tr>
								<td class='center' style="width: 30px;"><label><input
										type='checkbox' name='ids' value="${var.uid}" /><span
										class="lbl"></span> </label>
								</td>
								<td>${var.uid}</td>
								<td>${var.uname}</td>
								<td>${var.utel}</td>
								<td>${var.uemail}</td>
								<td>${var.role_name}</td>
								<c:if test="${QX.管理基本信息 == 1 }">
								<td style="width: 80px;">
								   <div class='hidden-phone visible-desktop btn-group'>
								       <a class='btn btn-mini btn-info' title="编辑" onclick="edit('${var.uid}');"><i class='icon-edit'></i></a>
								        <a class='btn btn-mini btn-warning' title="注销" onclick="logoff('${var.uid}');"><i class='icon-remove-sign'></i></a>
								       <a class='btn btn-mini btn-danger' title="删除" onclick="del('${var.uid}');"><i class='icon-trash'></i></a>
								      
								      
								   </div>
								</td>
								</c:if>
							</tr>
						</c:forEach>
					</c:when>
				</c:choose>
				</tbody>
			</table>
			
			</div>
			</div>
			
</form>


	
		
		
		<!-- 引入 -->
		<script type="text/javascript">window.jQuery || document.write("<script src='static/js/jquery-1.9.1.min.js'>\x3C/script>");</script>
		<script src="static/js/bootstrap.min.js"></script>
		<script src="static/js/ace-elements.min.js"></script>
		<script src="static/js/ace.min.js"></script>
		
		<script type="text/javascript" src="static/js/chosen.jquery.min.js"></script><!-- 下拉框 -->
		<script type="text/javascript" src="static/js/bootstrap-datepicker.min.js"></script><!-- 日期框 -->
		<script type="text/javascript" src="static/js/bootbox.min.js"></script><!-- 确认窗口 -->
		<!-- 引入 -->
		<script type="text/javascript" src="static/js/jquery.tips.js"></script><!--提示框-->
		<script type="text/javascript">
		//检索
		function search(){
			top.jzts();
			$("#Form").submit();
		}
//新增
function add(){
	 //top.jzts();
	 var diag = new top.Dialog();
	 diag.Drag=true;
	 diag.Title ="新增";
	 diag.URL = '<%=basePath%>user/goAdd.do';
	 diag.Width = 240;
	 diag.Height = 470;
	 diag.CancelEvent = function(){ //关闭事件
		 if(diag.innerFrame.contentWindow.document.getElementById('zhongxin').style.display == 'none'){
			 if('${page.currentPage}' == '0'){
				 top.jzts();
				 setTimeout("self.location=self.location",100);
			 }else{
				 window.location.href = 'user/list.do' ;
			 }
		}
		diag.close();
	 }
	 diag.show();
}

//修改
function edit(uid){
	 
	 var diag = new top.Dialog();
	 diag.Drag=true;
	 diag.Title ="编辑";
	 diag.URL = '<%=basePath%>user/goEdit.do?uid='+uid;
	 diag.Width = 240;
	 diag.Height = 470;
	 diag.CancelEvent = function(){ //关闭事件
		 if(diag.innerFrame.contentWindow.document.getElementById('zhongxin').style.display == 'none'){
			 window.location.href = 'user/list.do' ;
		}
		diag.close();
	 };
	 diag.show();
}
//删除
function del(uid){
	bootbox.confirm("确定要删除该设备吗?", function(result) {
		if(result) {
			//var url = '<%=basePath%>user/delete.do?uid='+uid;
			var url = "<%=basePath%>user/delete.do?uid="+uid+"&tm="+new Date().getTime();
			$.get(url,function(data){
				window.location.href = 'user/list.do' ;
			});
		}
	});
}
//批量操作

</script>

<script type="text/javascript">
$(function() {
	//复选框
	$('table th input:checkbox').on('click' , function(){
		var that = this;
		$(this).closest('table').find('tr > td:first-child input:checkbox')
		.each(function(){
			this.checked = that.checked;
			$(this).closest('tr').toggleClass('selected');
		});
			
	});
	
});
</script>
</body>
</html>

